package com.usian.controller;

import com.usian.pojo.User;
import com.usian.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RefreshScope //动态从nacos配置中心获取最新值
public class UserController {

    @Value("${config.info}")
    private String configInfo;

    @Autowired
    private UserService userService;


    @RequestMapping("/list")
    public List<User> list(){
        System.out.println(configInfo);
        return userService.findAll();
    }
}
